﻿import Rhino.Commons.Facilities
import Rhino.Security
import Rhino.Security.Interfaces from Rhino.Security
import System.Web.Mvc from System.Web.MVC
import System.Collections.Generic
import System
import WineCellar.Web from WineCellar.Web
import WineCellar.Business.Entities from WineCellar.Business
import WineCellar.Business.Services
import WineCellar.Business.ServiceInterfaces
import WineCellar.Core.Interfaces from WineCellar.Core
import Castle.Core.Interceptor from Castle.Core
import WineCellar.Core.Interceptors from WineCellar.Core
import WineCellar.Business.SecurityInterfaces from WineCellar.Business
import WineCellar.Core.NHibernate from WineCellar.Core


def DefineComponents():
	facility RhinoTransactionFacility

	facility RhinoSecurityFacility:
		securityTableStructure = SecurityTableStructure.Prefix
		userType = User	

	for type in AllTypesBased of IController("WineCellar.Web"):
		component type.Name.ToLower(), type:
			lifestyle Transient
			interceptor LoggingInterceptor

	Component "user_service", IUserService, UserService
	Component "wine_service", IEntityService of Wine, WineService  
	Component "region_service", IEntityService of Region, RegionService


	for type in AllTypesBased of IPropertyParser("WineCellar.Business.Helpers"):
		component type.Name, type, type	   
	
	Component "wine_entity_information_extractor", IEntityInformationExtractor of Wine, WineEntityInformationExtractor

	Component "capture_configuration", INHibernateInitializationAware, CaptureConfiguration